Action hook 'deleted_{$meta_type}meta'

in WP Core File wp-includes/meta.php at line 1100

View Source

deleted_{$meta_type}meta

Action Hook
Description
Fires immediately after deleting post or comment metadata of a specific type. The dynamic portion of the hook name, `$meta_type`, refers to the meta object type (post or comment). Possible hook names include: - `deleted_postmeta` - `deleted_commentmeta` - `deleted_termmeta` - `deleted_usermeta`

Hook Information

File Location wp-includes/meta.php View on GitHub
Hook Type Action
Line Number 1100

Hook Parameters

Type Name Description
int $meta_id Deleted metadata entry ID.

Usage Examples

Basic Usage
<?php
// Hook into deleted_{$meta_type}meta
add_action('deleted_{$meta_type}meta', 'my_custom_function', 10, 1);

function my_custom_function($meta_id) {
    // Your custom code here
}

Source Code Context

wp-includes/meta.php:1100 - How this hook is used in WordPress core
<?php
1095  			 *
1096  			 * @since 3.4.0
1097  			 *
1098  			 * @param int $meta_id Deleted metadata entry ID.
1099  			 */
1100  			do_action( "deleted_{$meta_type}meta", $meta_id );
1101  		}
1102  
1103  		return $result;
1104  
1105  	}

PHP Documentation

<?php
/**
			 * Fires immediately after deleting post or comment metadata of a specific type.
			 *
			 * The dynamic portion of the hook name, `$meta_type`, refers to the meta
			 * object type (post or comment).
			 *
			 * Possible hook names include:
			 *
			 *  - `deleted_postmeta`
			 *  - `deleted_commentmeta`
			 *  - `deleted_termmeta`
			 *  - `deleted_usermeta`
			 *
			 * @since 3.4.0
			 *
			 * @param int $meta_id Deleted metadata entry ID.
			 */
Quick Info
  • Hook Type: Action
  • Parameters: 1
  • File: wp-includes/meta.php
Related Hooks

Related hooks will be displayed here in future updates.